package chapter01;

public class Variable {
    public static void main(String[] args) {
        test1();
        test2();
    }

    // 自动类型提升
    public static void test1() {
        byte b1 = 1;
        short s1 = 2;
        int i1 = 3;
        long l1 = 4L;

        short s2 = b1;
        // 报错
        // short s3 = b1 + b1;
        int i2 = b1 + b1;

        char c1 = '2';
        char c2 = 97;
        System.out.println(c1 + ", "  + c2);
    }

    // 强制类型转换
    public static void test2() {
        double d1 = 10240.23;

        short s1 = (short)d1;
        System.out.println(s1);
    }
}
